package cn.bellychang.leetcode.question203;

/**
 * @author ChangLiang
 * @date 2021/3/7
 */
public class Solution5 {

    public ListNode removeElements(ListNode head, int val) {

        if(head==null){
            return head;
        }

        if(head.val==val){
            return removeElements(head.next, val);
        }else{
            head.next = removeElements(head.next, val);
            return head;
        }
    }
}
